package com.driver.core;

public class Configuraction {
    private String url;
    private String driver;
    private String username;
    private String password;
    private String table;
    private String packagePreffix;
    private String entityPackageName = "entity";
    private String mapperPackageName = "mapper";
    private String servicePackageName = "service";
    private String controllerPackageName = "controller";
    private String deleteTableNamePreffix;
    private boolean isLombok = false;


    public String getDeleteTableNamePreffix() {
        return deleteTableNamePreffix;
    }

    public void setDeleteTableNamePreffix(String deleteTableNamePreffix) {
        this.deleteTableNamePreffix = deleteTableNamePreffix;
    }

    public String getEntityPackageName() {
        return entityPackageName;
    }

    public void setEntityPackageName(String entityPackageName) {
        this.entityPackageName = entityPackageName;
    }

    public String getMapperPackageName() {
        return mapperPackageName;
    }

    public void setMapperPackageName(String mapperPackageName) {
        this.mapperPackageName = mapperPackageName;
    }

    public String getServicePackageName() {
        return servicePackageName;
    }

    public void setServicePackageName(String servicePackageName) {
        this.servicePackageName = servicePackageName;
    }

    public String getControllerPackageName() {
        return controllerPackageName;
    }

    public void setControllerPackageName(String controllerPackageName) {
        this.controllerPackageName = controllerPackageName;
    }

    public boolean isLombok() {
        return isLombok;
    }

    public void setLombok(boolean lombok) {
        isLombok = lombok;
    }

    public String getPackagePreffix() {
        return packagePreffix;
    }

    public void setPackagePreffix(String packagePreffix) {
        if (packagePreffix.endsWith(".")) {
            this.packagePreffix = packagePreffix.substring(0, packagePreffix.length() - 1);
        } else {
            this.packagePreffix = packagePreffix;
        }
    }

    public String getTable() {
        return table;
    }

    public void setTable(String table) {
        this.table = table;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {

        if (url.contains("mysql")) driver = "com.mysql.jdbc.Driver";
        if (url.contains("sqlserver")) driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
        this.url = url;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

}
